package app.system.controll;

import app.system.entity.*;
import app.system.entity.analyes.Comment;
import app.system.entity.analyes.FenCi;
import app.system.entity.analyes.MusicCount;
import app.system.entity.analyes.MusicList;
import app.system.service.*;
import app.utils.DateUtil;
import app.utils.EncryptTools;
import app.utils.VeDate;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.commons.codec.binary.Hex;
import org.apache.shiro.SecurityUtils;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpServletRequest;
import java.math.BigInteger;
import java.util.*;


@Controller
public class JumpPageControll {
    @Autowired
    private SysMusicService musicService;
    @Autowired
    private SysCommentService commentService;
    @Autowired
    private SysUserService userService;
    @Autowired
    private MusicMusicListService musicMusicListService;
    @Autowired
    private SysMusicListService musicListService;
    @Autowired
    private SysMusicLikeService musicLikeService;
    @Autowired
    private SysSingerService sysSingerService;
    @Autowired
    private CommentService commentService1;
    @Autowired
    private FenCiService fenCiService;
    @Autowired
    private AMusicListService aMusicListService;
    @Autowired
    private MusicCountService musicCountService;

    @GetMapping("/test")
    public String test()throws Exception{
        //私钥，随机16位字符串(自己可改)
        String secKey = "cd859f54539b25b7";
//            String text = "{\"username\": \"\", \"rememberLogin\": \"true\", \"password\": \"\"}";

        for (int k=2;k<600;k++){
            String text = "{rid:\"\", offset:"+(k-1)*20+", total:\"false\", limit:\"100\", csrf_token:\"\"}";
            String modulus = "00e0b509f6259df8642dbc35662901477df22677ec152b5ff68ace615bb7b725152b3ab17a876aea8a5aa76d2e417629ec4ee341f56135fccf695280104e0312ecbda92557c93870114af6c9d05c4f7f0c3685b7a46bee255932575cce10b424d813cfe4875d3e82047b97ddef52741d546b8e289dc6935b3ece0462db0a22b8e7";
            String nonce = "0CoJUm6Qyw8W8jud";
            String pubKey = "010001";
//2次AES加密，得到params
            String params = EncryptTools.encrypt(EncryptTools.encrypt(text, nonce), secKey);
            StringBuffer stringBuffer = new StringBuffer(secKey);
//逆置私钥
            secKey = stringBuffer.reverse().toString();
            String hex = Hex.encodeHexString(secKey.getBytes());
            BigInteger bigInteger1 = new BigInteger(hex, 16);
            BigInteger bigInteger2 = new BigInteger(pubKey, 16);
            BigInteger bigInteger3 = new BigInteger(modulus, 16);
//RSA加密计算
            BigInteger bigInteger4 = bigInteger1.pow(bigInteger2.intValue()).remainder(bigInteger3);
            String encSecKey= Hex.encodeHexString(bigInteger4.toByteArray());
//字符填充
            encSecKey= EncryptTools.zfill(encSecKey, 256);
//评论获取
            Document document = Jsoup.connect("http://music.163.com/weapi/v1/resource/comments/R_SO_4_468176711/")
                    .cookie("appver", "1.5.0.75771")
                    .header("Referer", "http://music.163.com/")
                    .data("params", params)
                    .data("encSecKey", encSecKey)
                    .ignoreContentType(true).post();
            System.out.println("评论：" + document.text());
//            getCommentData(document.text(),"468176711");
        }
        return "main";
    }

    @GetMapping("main")
    public String main(Model model){
        //传入歌单信息
        List<SysMusicList> musicListList = musicListService.getMusicListAll();
        List<SysMusicList> musicListList1 = new LinkedList<>();
        if (musicListList.size()>8){
           for (int i=0;i<8;i++){
               musicListList1.add(i,musicListList.get(i));
           }
           model.addAttribute("musicList",musicListList1);
        }else {
            model.addAttribute("musicList",musicListList);
        }
        SysUser sysUser = (SysUser) SecurityUtils.getSubject().getPrincipal();
        model.addAttribute("user",sysUser);

        return "main";
    }

    @GetMapping("login")
    public String login(){
        return "loginAndregister";
    }

//    @GetMapping("logout")
//    public String logout(HttpServletRequest request){
//        request.getSession().removeAttribute("user");
//        return "loginAndregister";
//    }

    /**
     * 个人主页
     * @return
     */
    @GetMapping("mypage")
    public String mypage(Model model){
        SysUser sysUser = (SysUser) SecurityUtils.getSubject().getPrincipal();
        SysUser sysUser1 = userService.selectUserByUserName(sysUser.getUser_name());
        model.addAttribute("user",sysUser1);
        return "mypage";
    }

    /**
     * 歌单
     * @return
     */
    @GetMapping("musiclist")
    public String musiclist(Model model,@RequestParam(value = "pageNum", defaultValue = "1") int pageNum){
        PageHelper.startPage(pageNum,12);
        PageInfo<SysMusicList> sysMusicListPageInfo = new PageInfo<SysMusicList>(musicListService.getMusicListAll());
        model.addAttribute("Music",sysMusicListPageInfo);
        List<SysMusicList> sysMusicLists = musicListService.getMusicListAll();
        Set<String> TypeSet = new HashSet<>();
        for (int i=0;i<sysMusicLists.size();i++){
            TypeSet.add(sysMusicLists.get(i).getList_type());
        }
        model.addAttribute("type",TypeSet);
        SysUser sysUser = (SysUser) SecurityUtils.getSubject().getPrincipal();
        model.addAttribute("user",sysUser);
        return "musiclist";
    }


    /**
     * 歌单展示
     * @return
     */
    @GetMapping("musiclistShow/{musicListId}")
    public String musiclistShow(@PathVariable("musicListId") String musicListId,Model model){
        SysMusicList sysMusicList = musicListService.selectSysMusicListById(musicListId);
        model.addAttribute("musicList",sysMusicList);

        //更新歌单播放量
        sysMusicList.setList_sum(sysMusicList.getList_sum()+1);
        musicListService.updateMusicListByTage(sysMusicList);

        MusicMusicLisit musicMusicLisit = new MusicMusicLisit();
        SysMusic sysMusic = new SysMusic();
        List<SysMusic> musicList = new LinkedList<>();
        musicMusicLisit.setMusiclist_id(musicListId);
        List<MusicMusicLisit> musicMusicLisits = musicMusicListService.selectMusicMusicListByTage(musicMusicLisit);
        for (int i=0;i<musicMusicLisits.size();i++){
            sysMusic.setMusic_id(musicMusicLisits.get(i).getMusic_id());
            if (musicService.selectMusicByTage(sysMusic).size()>0){
                SysMusic music = musicService.selectMusicByTage(sysMusic).get(0);
                musicList.add(i,music);
            }
        }
        model.addAttribute("musicL",musicList);
        SysUser sysUser = (SysUser) SecurityUtils.getSubject().getPrincipal();
        model.addAttribute("user",sysUser);
        return "musiclistShow";
    }

    /**
     * 创建歌单
     * @return
     */
    @GetMapping("musiclistCreat")
    public String musiclistCreat(@RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
                                 @RequestParam(value = "pageSize", defaultValue = "25") int pageSize,
                                 @RequestParam(value = "musiclistId",defaultValue = "0") String musiclistId,
                                 Model model){
        SysUser sysUser = (SysUser) SecurityUtils.getSubject().getPrincipal();
        SysUser user2 = userService.selectUserByUserName(sysUser.getUser_name());
        Page page = new Page();
        page.setPageNum(pageNum);
        page.setPageSize(pageSize);
        PageInfo<SysMusic> sysMusicPageInfo = musicService.getMusicAll(page);
        model.addAttribute("music",sysMusicPageInfo);
        System.out.println("登录用户信息--------------------"+JSONObject.toJSONString(user2));
        model.addAttribute("user",user2);

        if (musiclistId.length()>3){
            SysMusicList musicList = musicListService.selectSysMusicListById(musiclistId);
            model.addAttribute("list",musicList);
            model.addAttribute("list_id",musiclistId);
        }else {
            model.addAttribute("list",0);
        }

        Set<String> musicType = new HashSet<>();
        List<SysMusic> musicList = musicService.getMusicAllList();
        for (int i=0;i<musicList.size();i++){
            if (musicList.get(i) != null){
                musicType.add(musicList.get(i).getMusic_type());
            }
        }
        model.addAttribute("type",musicType);
        return "musiclistCreat";
    }


    /**
     * 音乐榜单
     * @return
     */
    @GetMapping("musicrank")
    public String musicrank(Model model){
        Page page = new Page();
        page.setPageNum(1);
        page.setPageSize(10);
        PageInfo<SysMusic> musicList = musicService.getMusicAll(page);
        model.addAttribute("music",musicList);

        SysUser sysUser = (SysUser) SecurityUtils.getSubject().getPrincipal();
        model.addAttribute("user",sysUser);
        return "musicrank";
    }

    /**
     * 音乐播放
     * @return
     */
    @GetMapping("musicruning/{musicId}")
    public String musicruning(@PathVariable("musicId") String musicId,Model model){
        SysMusic sysMusic = new SysMusic();
        sysMusic.setMusic_id(musicId);
        List<SysMusic> sysMusicList = musicService.selectMusicByTage(sysMusic);
        System.out.println(sysMusicList.size());
        if (sysMusicList.size()>0){
            model.addAttribute("music",sysMusicList.get(0));
        }
        //更新音乐播放量
        SysMusicLike sysMusicLike = new SysMusicLike();
        sysMusicLike.setMusic_id(musicId);
        List<SysMusicLike> sysMusicLikeList = musicLikeService.selectMusicLikeByTage(sysMusicLike);
        if (sysMusicLikeList.size()>0){
            musicLikeService.updateMusicLikeByTage(sysMusicLike);
        }else {
            sysMusicLike.setMusic_hearsum(1);
            musicLikeService.saveMusicLike(sysMusicLike);
        }

        SysUser sysUser = (SysUser) SecurityUtils.getSubject().getPrincipal();
        model.addAttribute("user",sysUser);

        SysComment sysComment = new SysComment();
        sysComment.setComment_musicid(musicId);
        List<SysComment> resultList = new LinkedList<>();
        List<SysComment> sysCommentList = commentService.secletCommentByTage(sysComment);
        for (SysComment sysComment1:sysCommentList){
            SysUser sysUser1 = new SysUser();
            sysUser1.setUser_id(sysComment1.getComment_userid());
            System.out.println(JSONObject.toJSONString(sysComment1));
            List<SysUser> sysUserList =  userService.selectUserByTage(sysUser1);
            System.out.println(sysUserList);
            if (sysUserList.size()>0){
                sysComment1.setUser_name(sysUserList.get(0).getUser_name());
                sysComment1.setUser_headUrl(sysUserList.get(0).getUser_headurl());
                resultList.add(sysComment1);
            }
        }
        model.addAttribute("commentlist",resultList);
        return "musicruning";
    }


    /**
     * 歌手
     * @return
     */
    @GetMapping("musicsinger")
    public String musicsinger(Model model,@RequestParam(value = "pageNum", defaultValue = "1") int pageNum){
        PageHelper.startPage(pageNum,16);
        PageInfo<SysSinger> sysSingerPageInfo = new PageInfo<SysSinger>(sysSingerService.getSingerAll());
//        List<SysMusic> sysMusicList = musicService.getMusicAllList();
//        SysSinger sysSinger = new SysSinger();
//        List<SysMusic> sysMusicHashSet = new LinkedList<>();
//        List<String> SingerName = new LinkedList<>();
//        for (int i=0;i<sysMusicList.size();i++){
//            String singer = sysMusicList.get(i).getMusic_author();
//            if (singer.length()<=3){
//                if (!SingerName.contains(singer)){
//                    sysSinger.setSinger_name(singer);
//                    sysSinger.setSinger_photourl(sysMusicList.get(i).getMusic_phoyourl());
//                    sysSingerService.saveSinger(sysSinger);
////                    sysMusicHashSet.add(sysMusicList.get(i));
//                    SingerName.add(singer);
//                }
//            }
//        }
//        List<SysMusic> sysMusicList1 = sysMusicHashSet;
//        PageHelper.startPage(pageNum,16);
//        PageInfo<SysMusic> musicPageInfo = new PageInfo<SysMusic>(sysMusicList1);
//        System.out.println(JSONObject.toJSONString(musicPageInfo));
        model.addAttribute("Music",sysSingerPageInfo);
        SysUser sysUser = (SysUser) SecurityUtils.getSubject().getPrincipal();
        model.addAttribute("user",sysUser);
        return "musicsinger";
    }

    /**
     * 歌手页面展示
     * @return
     */
    @GetMapping("singerShow/{auther}")
    public String singerShow(@PathVariable("auther") String auther,Model model){
        SysMusic sysMusic = new SysMusic();
        sysMusic.setMusic_author(auther);
        List<SysMusic> musicList = musicService.selectMusicByTage(sysMusic);
        model.addAttribute("music",musicList);

        SysSinger sysSinger = new SysSinger();
        sysSinger.setSinger_name(auther);
        List<SysSinger> sysSingerList = sysSingerService.selectSingerByTage(sysSinger);
        if (sysSingerList.size()>0){
            model.addAttribute("singer",sysSingerList.get(0));
        }
        SysUser sysUser = (SysUser) SecurityUtils.getSubject().getPrincipal();
        model.addAttribute("user",sysUser);
        return "singerShow";
    }

    /**
     * 音乐发布
     * @return
     */
    @GetMapping("musicupload")
    public String musicupload(Model model){
        SysUser sysUser = (SysUser) SecurityUtils.getSubject().getPrincipal();
        model.addAttribute("user",sysUser);
        return "musicuplod";
    }

    /**
     * 音乐可视化大屏分析
     * @return
     */
    @GetMapping("visual")
    public String visual(Model model){
        FenCi fenCi = new FenCi();
        fenCi.setMusic_id("468176711");
        List<FenCi> CiYunList = fenCiService.selectFenCi(fenCi);
        model.addAttribute("ciyun",CiYunList);

        String[] MusicType = {"网络流行榜","抖音传唱榜","网易热门榜","酷狗TOP榜",
                "DJ热歌榜","欧美音乐榜","韩语音乐榜","日语音乐榜","古装金曲榜","电影主题榜","爱国热血榜",
                "80热歌榜","90热歌榜","粤语金曲榜"};
        List<String> typeList = new LinkedList<>();
        List<Integer> value = new LinkedList<>();
        for (int i=0;i<MusicType.length;i++){
            String typeS = MusicType[i];
            typeList.add(typeS.substring(0,typeS.length()-3));
            value.add(musicService.selectMusicCount(MusicType[i]));
        }
        model.addAttribute("type",typeList);
        model.addAttribute("value",value);

        Set<String> timeSet = new HashSet<>();
        Comment comment = new Comment();
        comment.setMusic_id("468176711");
        List<Comment> commentList = commentService1.selectComment(comment);
        List<String> timeList = new LinkedList<>();
        List<Integer> timeCount = new LinkedList<>();
        for (int j=0;j<commentList.size();j++){
            timeSet.add(commentList.get(j).getTime());
        }
        for (String timeS:timeSet){
            timeList.add(timeS.substring(11,timeS.length()));
            timeCount.add(commentService1.selectCommentCount(timeS));
        }
        model.addAttribute("time",timeList);
        model.addAttribute("timeCount",timeCount);

        Set<String> musicTypeSet = new HashSet<>();
        List<String> musicList = new LinkedList<>();
        List<Integer> musinListCount = new LinkedList<>();
        List<SysMusicList> sysMusicListList = musicListService.getMusicListAll();
        for (SysMusicList sysMusicList:sysMusicListList){
            musicTypeSet.add(sysMusicList.getList_type());
        }
        for (String musicListType:musicTypeSet){
            musicList.add(musicListType);
            musinListCount.add(musicListService.selectMusicCount(musicListType));
            System.out.println(musicListType);
            System.out.println(musicListService.selectMusicCount(musicListType));
        }
        model.addAttribute("musicList",musicList);
        model.addAttribute("musinListCount",musinListCount);

        List<MusicCount> musicCounts = musicCountService.getMusicCountAll();
        Set<String> autherSet = new HashSet<>();
        Set<Integer> autherCountSet = new HashSet<>();
        for (MusicCount musicCount:musicCounts){
            if (musicCount.getCount()>20){
                autherSet.add(musicCount.getAuther());
                autherCountSet.add(musicCount.getCount());
            }
        }
        model.addAttribute("authercount",autherCountSet);
        model.addAttribute("auther",autherSet);




        int GetMusicCount = musicService.getMusicCount();
        model.addAttribute("GetMusicCount",GetMusicCount);

        int GetCommentCount = commentService1.getCommentCount();
        model.addAttribute("GetCommentCount",GetCommentCount);


        return "visual";
    }


    public void getCommentData(String reponse,String musinid) {
        String data = "{\"isMusician\":false,\"userId\":-1,\"topComments\":[],\"moreHot\":true,\"hotComments\":[{\"user\":{\"locationInfo\":null,\"liveInfo\":null,\"anonym\":0,\"commonIdentity\":null,\"userId\":259825231,\"avatarDetail\":null,\"userType\":0,\"mutual\":false,\"remarkName\":null,\"vipRights\":null,\"nickname\":\"城南花已开\",\"avatarUrl\":\"http://p2.music.126.net/uarVFKgUlrI9Z1nr-50cAw==/109951162843608471.jpg\",\"authStatus\":0,\"expertTags\":null,\"experts\":null,\"vipType\":0,\"followed\":false},\"beReplied\":[],\"pendantData\":null,\"showFloorComment\":null,\"status\":0,\"commentId\":339563412,\"content\":\"君安在，谢谢十二亩地，谢谢所有关心我的人，谢谢你们！早上因为治疗现在才看见，我会坚持的！\",\"contentResource\":null,\"time\":1490505611340,\"timeStr\":\"2017-03-26\",\"needDisplayTime\":true,\"likedCount\":1619476,\"expressionUrl\":null,\"commentLocationType\":0,\"parentCommentId\":0,\"decoration\":null,\"repliedMark\":null,\"liked\":false},{\"user\":{\"locationInfo\":null,\"liveInfo\":null,\"anonym\":0,\"commonIdentity\":null,\"userId\":22034796,\"avatarDetail\":{\"userType\":4,\"identityLevel\":1,\"identityIconUrl\":\"https://p5.music.126.net/obj/wo3DlcOGw6DClTvDisK1/4874132307/4499/f228/d867/da64b9725e125943ad4e14e4c72d0884.png\"},\"userType\":4,\"mutual\":false,\"remarkName\":null,\"vipRights\":{\"associator\":{\"vipCode\":100,\"rights\":true},\"musicPackage\":null,\"redVipAnnualCount\":1,\"redVipLevel\":6},\"nickname\":\"音乐人-三亩地\",\"avatarUrl\":\"http://p2.music.126.net/v48epNRPRqoq11M7jlgqBA==/18635622580018243.jpg\",\"authStatus\":1,\"expertTags\":null,\"experts\":null,\"vipType\":11,\"followed\":false},\"beReplied\":[],\"pendantData\":{\"id\":23000,\"imageUrl\":\"http://p1.music.126.net/ZEO9g9k8tzY9YOVNwWqYCg==/109951164219707590.jpg\"},\"showFloorComment\":null,\"status\":0,\"commentId\":339324278,\"content\":\"前段时间一位喜欢我音乐的朋友私信我，说他得了骨癌晚期还有半年的时间，希望我用他云音乐的ID写首曲子，他很喜欢他的ID，然后发给我了很多医院的照片怕我不相信，我看到消息的时候正好我没有设备和乐器去创作，把运输的设备弄好第一时间去创作，终于完成了！送给城南花已开，希望你能听到，一切都好！\",\"contentResource\":null,\"time\":1490470188493,\"timeStr\":\"2017-03-26\",\"needDisplayTime\":true,\"likedCount\":1057808,\"expressionUrl\":null,\"commentLocationType\":1,\"parentCommentId\":0,\"decoration\":null,\"repliedMark\":null,\"liked\":false},{\"user\":{\"locationInfo\":null,\"liveInfo\":null,\"anonym\":0,\"commonIdentity\":null,\"userId\":259825231,\"avatarDetail\":null,\"userType\":0,\"mutual\":false,\"remarkName\":null,\"vipRights\":null,\"nickname\":\"城南花已开\",\"avatarUrl\":\"http://p2.music.126.net/uarVFKgUlrI9Z1nr-50cAw==/109951162843608471.jpg\",\"authStatus\":0,\"expertTags\":null,\"experts\":null,\"vipType\":0,\"followed\":false},\"beReplied\":[],\"pendantData\":null,\"showFloorComment\":null,\"status\":0,\"commentId\":339844418,\"content\":\"谢谢私信给我朋友们，真心谢谢你们！我好坚持加油的！\",\"contentResource\":null,\"time\":1490530469354,\"timeStr\":\"2017-03-26\",\"needDisplayTime\":true,\"likedCount\":742306,\"expressionUrl\":null,\"commentLocationType\":0,\"parentCommentId\":0,\"decoration\":null,\"repliedMark\":null,\"liked\":false},{\"user\":{\"locationInfo\":null,\"liveInfo\":null,\"anonym\":0,\"commonIdentity\":null,\"userId\":259825231,\"avatarDetail\":null,\"userType\":0,\"mutual\":false,\"remarkName\":null,\"vipRights\":null,\"nickname\":\"城南花已开\",\"avatarUrl\":\"http://p2.music.126.net/uarVFKgUlrI9Z1nr-50cAw==/109951162843608471.jpg\",\"authStatus\":0,\"expertTags\":null,\"experts\":null,\"vipType\":0,\"followed\":false},\"beReplied\":[],\"pendantData\":null,\"showFloorComment\":null,\"status\":0,\"commentId\":341090748,\"content\":\"我会间接性更新我动态，我不会放弃，谢谢你们关心我的人！\",\"contentResource\":null,\"time\":1490686015403,\"timeStr\":\"2017-03-28\",\"needDisplayTime\":true,\"likedCount\":663711,\"expressionUrl\":null,\"commentLocationType\":0,\"parentCommentId\":0,\"decoration\":null,\"repliedMark\":null,\"liked\":false},{\"user\":{\"locationInfo\":null,\"liveInfo\":null,\"anonym\":0,\"commonIdentity\":null,\"userId\":259825231,\"avatarDetail\":null,\"userType\":0,\"mutual\":false,\"remarkName\":null,\"vipRights\":null,\"nickname\":\"城南花已开\",\"avatarUrl\":\"http://p2.music.126.net/uarVFKgUlrI9Z1nr-50cAw==/109951162843608471.jpg\",\"authStatus\":0,\"expertTags\":null,\"experts\":null,\"vipType\":0,\"followed\":false},\"beReplied\":[],\"pendantData\":null,\"showFloorComment\":null,\"status\":0,\"commentId\":342357067,\"content\":\"抱歉各位，今天化疗很痛苦中间受不了痛苦就晕了，醒了就一直在看评论，和私息，我就不一一回复，谢谢你们，前几天做的检查结果也下来了，我也做好最坏的打算了！但是我不会放弃！加油自己\",\"contentResource\":null,\"time\":1490804968493,\"timeStr\":\"2017-03-30\",\"needDisplayTime\":true,\"likedCount\":613320,\"expressionUrl\":null,\"commentLocationType\":0,\"parentCommentId\":0,\"decoration\":null,\"repliedMark\":null,\"liked\":false},{\"user\":{\"locationInfo\":null,\"liveInfo\":null,\"anonym\":0,\"commonIdentity\":null,\"userId\":22034796,\"avatarDetail\":{\"userType\":4,\"identityLevel\":1,\"identityIconUrl\":\"https://p5.music.126.net/obj/wo3DlcOGw6DClTvDisK1/4874132307/4499/f228/d867/da64b9725e125943ad4e14e4c72d0884.png\"},\"userType\":4,\"mutual\":false,\"remarkName\":null,\"vipRights\":{\"associator\":{\"vipCode\":100,\"rights\":true},\"musicPackage\":null,\"redVipAnnualCount\":1,\"redVipLevel\":6},\"nickname\":\"音乐人-三亩地\",\"avatarUrl\":\"http://p2.music.126.net/v48epNRPRqoq11M7jlgqBA==/18635622580018243.jpg\",\"authStatus\":1,\"expertTags\":null,\"experts\":null,\"vipType\":11,\"followed\":false},\"beReplied\":[],\"pendantData\":{\"id\":23000,\"imageUrl\":\"http://p1.music.126.net/ZEO9g9k8tzY9YOVNwWqYCg==/109951164219707590.jpg\"},\"showFloorComment\":null,\"status\":0,\"commentId\":339314927,\"content\":\"专辑封面是这位同学的头像。\",\"contentResource\":null,\"time\":1490471015162,\"timeStr\":\"2017-03-26\",\"needDisplayTime\":true,\"likedCount\":448911,\"expressionUrl\":null,\"commentLocationType\":1,\"parentCommentId\":0,\"decoration\":null,\"repliedMark\":null,\"liked\":false},{\"user\":{\"locationInfo\":null,\"liveInfo\":null,\"anonym\":0,\"commonIdentity\":null,\"userId\":259825231,\"avatarDetail\":null,\"userType\":0,\"mutual\":false,\"remarkName\":null,\"vipRights\":null,\"nickname\":\"城南花已开\",\"avatarUrl\":\"http://p2.music.126.net/uarVFKgUlrI9Z1nr-50cAw==/109951162843608471.jpg\",\"authStatus\":0,\"expertTags\":null,\"experts\":null,\"vipType\":0,\"followed\":false},\"beReplied\":[],\"pendantData\":null,\"showFloorComment\":null,\"status\":0,\"commentId\":343874034,\"content\":\"三月的最后一天，我最喜欢的月份即将过去了，希望明年三月我带你们去看城南花开！城南花已开，花开花落时！\",\"contentResource\":null,\"time\":1490962574179,\"timeStr\":\"2017-03-31\",\"needDisplayTime\":true,\"likedCount\":446301,\"expressionUrl\":null,\"commentLocationType\":0,\"parentCommentId\":0,\"decoration\":null,\"repliedMark\":null,\"liked\":false},{\"user\":{\"locationInfo\":null,\"liveInfo\":null,\"anonym\":0,\"commonIdentity\":null,\"userId\":454859496,\"avatarDetail\":null,\"userType\":0,\"mutual\":false,\"remarkName\":null,\"vipRights\":null,\"nickname\":\"北方的喵先生\",\"avatarUrl\":\"http://p2.music.126.net/9Q8mficW1R7OUHgJ_Qy2Wg==/19058934555942521.jpg\",\"authStatus\":0,\"expertTags\":null,\"experts\":null,\"vipType\":0,\"followed\":false},\"beReplied\":[],\"pendantData\":null,\"showFloorComment\":null,\"status\":0,\"commentId\":353216398,\"content\":\"2011年mds，比白血病还牛逼的病，病因不明，国际无特效药，入院后分小组治疗，13人小组，1年后，我走出医院大门时小组里有2个一辈子废人，另外10个户口本注销了，那天我哭的跟个傻逼一样，他们说我是医学上的小奇迹，其实我就是不信我会死，嘿，相信奇迹，嘿，抬头！\",\"contentResource\":null,\"time\":1491828919855,\"timeStr\":\"2017-04-10\",\"needDisplayTime\":true,\"likedCount\":250226,\"expressionUrl\":null,\"commentLocationType\":0,\"parentCommentId\":0,\"decoration\":null,\"repliedMark\":null,\"liked\":false},{\"user\":{\"locationInfo\":null,\"liveInfo\":null,\"anonym\":0,\"commonIdentity\":null,\"userId\":420873655,\"avatarDetail\":{\"userType\":207,\"identityLevel\":1,\"identityIconUrl\":\"https://p5.music.126.net/obj/wo3DlcOGw6DClTvDisK1/4761340149/f4bf/64a1/1ea2/31a08617d7dfddb21fffdb92390ce268.png\"},\"userType\":207,\"mutual\":false,\"remarkName\":null,\"vipRights\":{\"associator\":{\"vipCode\":100,\"rights\":true},\"musicPackage\":null,\"redVipAnnualCount\":1,\"redVipLevel\":3},\"nickname\":\"dzff01\",\"avatarUrl\":\"http://p2.music.126.net/W8ACaAu6TbE5TJ-TqpK8GQ==/109951164787855471.jpg\",\"authStatus\":0,\"expertTags\":null,\"experts\":null,\"vipType\":11,\"followed\":false},\"beReplied\":[],\"pendantData\":{\"id\":4009,\"imageUrl\":\"http://p1.music.126.net/EIySl1gRwlc3ZqV2-RMX8Q==/109951163313154546.jpg\"},\"showFloorComment\":null,\"status\":0,\"commentId\":1093792487,\"content\":\"直到那天我才明白城南的签名\\n\\n城南花已开 花开花落时\\n\\n其实城南已经绽放过一回了，他也早就料到了结局。\\n\\n一个只属于网易的故事 一个让我惦念了很久的陌生人...愿十几万的网易云友都能像城南一样坚强。\",\"contentResource\":null,\"time\":1524376007298,\"timeStr\":\"2018-04-22\",\"needDisplayTime\":true,\"likedCount\":218157,\"expressionUrl\":null,\"commentLocationType\":0,\"parentCommentId\":0,\"decoration\":null,\"repliedMark\":null,\"liked\":false},{\"user\":{\"locationInfo\":null,\"liveInfo\":null,\"anonym\":0,\"commonIdentity\":null,\"userId\":270992406,\"avatarDetail\":null,\"userType\":0,\"mutual\":false,\"remarkName\":null,\"vipRights\":{\"associator\":{\"vipCode\":100,\"rights\":true},\"musicPackage\":null,\"redVipAnnualCount\":-1,\"redVipLevel\":3},\"nickname\":\"_Spirited-away\",\"avatarUrl\":\"http://p2.music.126.net/NFLTvqVUKe5Bo2VwaOKlfA==/109951165316908977.jpg\",\"authStatus\":0,\"expertTags\":null,\"experts\":null,\"vipType\":11,\"followed\":false},\"beReplied\":[],\"pendantData\":{\"id\":4000,\"imageUrl\":\"http://p1.music.126.net/xE4CwIWXUkwvf-h9Jo5sQw==/109951163313111359.jpg\"},\"showFloorComment\":null,\"status\":0,\"commentId\":1070837926,\"content\":\"如果4月你醒了我们就去看牡丹花，\\n如果5月你醒了我们就去看石榴花，\\n如果6月你醒了我们就去看荷花，\\n如果7月你醒了我们就去看蜀葵花，\\n如果8月你醒了我们就去看桂花，\\n如果9月你醒了我们就去看菊花，\\n如果10月你醒了我们就去看芙蓉，\\n如果11月你醒了我们就去看茶花，\\n如果12月你醒了我们就去看水仙，\",\"contentResource\":null,\"time\":1522512828165,\"timeStr\":\"2018-04-01\",\"needDisplayTime\":true,\"likedCount\":207803,\"expressionUrl\":null,\"commentLocationType\":0,\"parentCommentId\":0,\"decoration\":null,\"repliedMark\":null,\"liked\":false},{\"user\":{\"locationInfo\":null,\"liveInfo\":null,\"anonym\":0,\"commonIdentity\":null,\"userId\":73873350,\"avatarDetail\":null,\"userType\":0,\"mutual\":false,\"remarkName\":null,\"vipRights\":null,\"nickname\":\"公子甄\",\"avatarUrl\":\"http://p2.music.126.net/JmIaX2yJY8H5g7ykkQbLEw==/109951162794490403.jpg\",\"authStatus\":0,\"expertTags\":null,\"experts\":null,\"vipType\":0,\"followed\":false},\"beReplied\":[],\"pendantData\":null,\"showFloorComment\":null,\"status\":0,\"commentId\":339347192,\"content\":\"心念城南好风景\\n花开时节愿逢君\\n愿你携一身洁白\\n翘首以盼君病愈\",\"contentResource\":null,\"time\":1490483746055,\"timeStr\":\"2017-03-26\",\"needDisplayTime\":true,\"likedCount\":201250,\"expressionUrl\":null,\"commentLocationType\":0,\"parentCommentId\":0,\"decoration\":null,\"repliedMark\":null,\"liked\":false},{\"user\":{\"locationInfo\":null,\"liveInfo\":null,\"anonym\":0,\"commonIdentity\":null,\"userId\":259825231,\"avatarDetail\":null,\"userType\":0,\"mutual\":false,\"remarkName\":null,\"vipRights\":null,\"nickname\":\"城南花已开\",\"avatarUrl\":\"http://p2.music.126.net/uarVFKgUlrI9Z1nr-50cAw==/109951162843608471.jpg\",\"authStatus\":0,\"expertTags\":null,\"experts\":null,\"vipType\":0,\"followed\":false},\"beReplied\":[],\"pendantData\":null,\"showFloorComment\":null,\"status\":0,\"commentId\":352587703,\"content\":\"一把油伞，一个人，一缕魂，两伴而行，我这里下雨了我很喜欢下雨天，我在散步，这几天安稳的回家了几天一直在陪家人！谢谢你们\",\"contentResource\":null,\"time\":1491819424154,\"timeStr\":\"2017-04-10\",\"needDisplayTime\":true,\"likedCount\":152691,\"expressionUrl\":null,\"commentLocationType\":0,\"parentCommentId\":0,\"decoration\":null,\"repliedMark\":null,\"liked\":false},{\"user\":{\"locationInfo\":null,\"liveInfo\":null,\"anonym\":0,\"commonIdentity\":null,\"userId\":105294753,\"avatarDetail\":null,\"userType\":0,\"mutual\":false,\"remarkName\":null,\"vipRights\":null,\"nickname\":\"小白就爱啃菠萝\",\"avatarUrl\":\"http://p2.music.126.net/Ow61P9VRdRBDyw11WrSTxQ==/109951166078041133.jpg\",\"authStatus\":0,\"expertTags\":null,\"experts\":null,\"vipType\":0,\"followed\":false},\"beReplied\":[{\"user\":{\"locationInfo\":null,\"liveInfo\":null,\"anonym\":0,\"commonIdentity\":null,\"userId\":259825231,\"avatarDetail\":null,\"userType\":0,\"mutual\":false,\"remarkName\":null,\"vipRights\":null,\"nickname\":\"城南花已开\",\"avatarUrl\":\"http://p2.music.126.net/uarVFKgUlrI9Z1nr-50cAw==/109951162843608471.jpg\",\"authStatus\":0,\"expertTags\":null,\"experts\":null,\"vipType\":0,\"followed\":false},\"beRepliedCommentId\":339563412,\"content\":\"君安在，谢谢十二亩地，谢谢所有关心我的人，谢谢你们！早上因为治疗现在才看见，我会坚持的！\",\"status\":0,\"expressionUrl\":null}],\"pendantData\":null,\"showFloorComment\":null,\"status\":0,\"commentId\":339701045,\"content\":\"我是一名医学生，15年毕业考研失败，今年三战，今早得知被录了，学校一般，但是我找到了人生的方向，在这之前我也是心如死灰，我曾一度怀疑自己，一度想去死，想一切重新开始，还好我没放弃自己。兄弟，说了这么多我只想告诉你，加油，别放弃，奇迹一定会有的，你会好起来的相信我\",\"contentResource\":null,\"time\":1490516785431,\"timeStr\":\"2017-03-26\",\"needDisplayTime\":true,\"likedCount\":135570,\"expressionUrl\":null,\"commentLocationType\":0,\"parentCommentId\":0,\"decoration\":null,\"repliedMark\":null,\"liked\":false},{\"user\":{\"locationInfo\":null,\"liveInfo\":null,\"anonym\":0,\"commonIdentity\":null,\"userId\":255726071,\"avatarDetail\":{\"userType\":207,\"identityLevel\":1,\"identityIconUrl\":\"https://p5.music.126.net/obj/wo3DlcOGw6DClTvDisK1/4761340149/f4bf/64a1/1ea2/31a08617d7dfddb21fffdb92390ce268.png\"},\"userType\":207,\"mutual\":false,\"remarkName\":null,\"vipRights\":{\"associator\":{\"vipCode\":100,\"rights\":true},\"musicPackage\":null,\"redVipAnnualCount\":1,\"redVipLevel\":6},\"nickname\":\"宇宙之大__\",\"avatarUrl\":\"http://p1.music.126.net/RxgQLkN6SDXBZNlVAY7hcw==/109951164694732402.jpg\",\"authStatus\":0,\"expertTags\":null,\"experts\":null,\"vipType\":11,\"followed\":false},\"beReplied\":[],\"pendantData\":{\"id\":59203,\"imageUrl\":\"http://p1.music.126.net/P40Tut6mJHNKA2GBb-AZoA==/109951164881213901.jpg\"},\"showFloorComment\":null,\"status\":0,\"commentId\":1083071000,\"content\":\"对不起，来晚了。原来你2.25就逝去了。不过，有这么多人在最后的时光鼓励你，祝愿你，现在还纪念你，包括以后他们的生命里。有这样一首充满大爱的曲子，连接起这个世上素昧平生的我们。想到这些你应该也会会心一笑的吧。[爱心]\",\"contentResource\":null,\"time\":1523536989559,\"timeStr\":\"2018-04-12\",\"needDisplayTime\":true,\"likedCount\":128390,\"expressionUrl\":null,\"commentLocationType\":0,\"parentCommentId\":0,\"decoration\":null,\"repliedMark\":null,\"liked\":false},{\"user\":{\"locationInfo\":null,\"liveInfo\":null,\"anonym\":0,\"commonIdentity\":null,\"userId\":351916448,\"avatarDetail\":{\"userType\":207,\"identityLevel\":1,\"identityIconUrl\":\"https://p5.music.126.net/obj/wo3DlcOGw6DClTvDisK1/4761340149/f4bf/64a1/1ea2/31a08617d7dfddb21fffdb92390ce268.png\"},\"userType\":207,\"mutual\":false,\"remarkName\":null,\"vipRights\":null,\"nickname\":\"桑梓在北\",\"avatarUrl\":\"http://p1.music.126.net/Q1E-6QIx1ovm6LgN2kWpJA==/109951165862590678.jpg\",\"authStatus\":0,\"expertTags\":null,\"experts\":null,\"vipType\":0,\"followed\":false},\"beReplied\":[],\"pendantData\":null,\"showFloorComment\":null,\"status\":0,\"commentId\":339361597,\"content\":\"听了第一下就决定下载的曲子。是啊，城南的花都开了，慢慢的，城北，国北，再往北，生机随着花朵洒满每一寸世界，每一个北半球的国度，未来或现在，有人如同花朵一般陪你或等着你。不论怎样，还有希望。\",\"contentResource\":null,\"time\":1490487902843,\"timeStr\":\"2017-03-26\",\"needDisplayTime\":true,\"likedCount\":113982,\"expressionUrl\":null,\"commentLocationType\":0,\"parentCommentId\":0,\"decoration\":null,\"repliedMark\":null,\"liked\":false}],\"commentBanner\":null,\"code\":200,\"comments\":[{\"user\":{\"locationInfo\":null,\"liveInfo\":null,\"anonym\":0,\"commonIdentity\":null,\"userId\":1628859646,\"avatarDetail\":null,\"userType\":0,\"mutual\":false,\"remarkName\":null,\"vipRights\":{\"associator\":{\"vipCode\":100,\"rights\":true},\"musicPackage\":null,\"redVipAnnualCount\":-1,\"redVipLevel\":1},\"nickname\":\"D_yee\",\"avatarUrl\":\"http://p1.music.126.net/_yEYJUd71QvZtNFpjMR6_Q==/109951167057949245.jpg\",\"authStatus\":0,\"expertTags\":null,\"experts\":null,\"vipType\":11,\"followed\":false},\"beReplied\":[],\"pendantData\":{\"id\":4000,\"imageUrl\":\"http://p1.music.126.net/xE4CwIWXUkwvf-h9Jo5sQw==/109951163313111359.jpg\"},\"showFloorComment\":null,\"status\":0,\"commentId\":5601378410,\"content\":\"初中的时候，学校早晨晨报就是这个用这个音乐开头，每天踩着朝阳，提着早点，向教室跑。\",\"contentResource\":null,\"time\":1646046637736,\"timeStr\":\"1分钟前\",\"needDisplayTime\":true,\"likedCount\":0,\"expressionUrl\":null,\"commentLocationType\":0,\"parentCommentId\":0,\"decoration\":{},\"repliedMark\":null,\"liked\":false},{\"user\":{\"locationInfo\":null,\"liveInfo\":null,\"anonym\":0,\"commonIdentity\":null,\"userId\":3310254521,\"avatarDetail\":null,\"userType\":0,\"mutual\":false,\"remarkName\":null,\"vipRights\":null,\"nickname\":\"你曾有\",\"avatarUrl\":\"http://p1.music.126.net/zutZveQN9NEfTpKdk3ngmA==/109951165033970333.jpg\",\"authStatus\":0,\"expertTags\":null,\"experts\":null,\"vipType\":0,\"followed\":false},\"beReplied\":[],\"pendantData\":null,\"showFloorComment\":null,\"status\":0,\"commentId\":5601377179,\"content\":\"3月到了 还好吗 “我陪你去看花开”\",\"contentResource\":null,\"time\":1646046437366,\"timeStr\":\"5分钟前\",\"needDisplayTime\":true,\"likedCount\":1,\"expressionUrl\":null,\"commentLocationType\":0,\"parentCommentId\":0,\"decoration\":{},\"repliedMark\":null,\"liked\":false},{\"user\":{\"locationInfo\":null,\"liveInfo\":null,\"anonym\":0,\"commonIdentity\":null,\"userId\":1295819281,\"avatarDetail\":null,\"userType\":0,\"mutual\":false,\"remarkName\":null,\"vipRights\":{\"associator\":{\"vipCode\":100,\"rights\":true},\"musicPackage\":null,\"redVipAnnualCount\":1,\"redVipLevel\":5},\"nickname\":\"havem-\",\"avatarUrl\":\"http://p1.music.126.net/BL0BGp8RCSYFLuxkIS2RlA==/109951165798381584.jpg\",\"authStatus\":0,\"expertTags\":null,\"experts\":null,\"vipType\":11,\"followed\":false},\"beReplied\":[{\"user\":{\"locationInfo\":null,\"liveInfo\":null,\"anonym\":0,\"commonIdentity\":null,\"userId\":259825231,\"avatarDetail\":null,\"userType\":0,\"mutual\":false,\"remarkName\":null,\"vipRights\":null,\"nickname\":\"城南花已开\",\"avatarUrl\":\"http://p1.music.126.net/uarVFKgUlrI9Z1nr-50cAw==/109951162843608471.jpg\",\"authStatus\":0,\"expertTags\":null,\"experts\":null,\"vipType\":0,\"followed\":false},\"beRepliedCommentId\":339563412,\"content\":\"君安在，谢谢十二亩地，谢谢所有关心我的人，谢谢你们！早上因为治疗现在才看见，我会坚持的！\",\"status\":0,\"expressionUrl\":null}],\"pendantData\":{\"id\":4000,\"imageUrl\":\"http://p1.music.126.net/xE4CwIWXUkwvf-h9Jo5sQw==/109951163313111359.jpg\"},\"showFloorComment\":null,\"status\":0,\"commentId\":5601372149,\"content\":\"还好吗\",\"contentResource\":null,\"time\":1646045895208,\"timeStr\":\"14分钟前\",\"needDisplayTime\":true,\"likedCount\":0,\"expressionUrl\":null,\"commentLocationType\":0,\"parentCommentId\":339563412,\"decoration\":{},\"repliedMark\":null,\"liked\":false},{\"user\":{\"locationInfo\":null,\"liveInfo\":null,\"anonym\":0,\"commonIdentity\":null,\"userId\":412310959,\"avatarDetail\":null,\"userType\":0,\"mutual\":false,\"remarkName\":null,\"vipRights\":{\"associator\":{\"vipCode\":100,\"rights\":true},\"musicPackage\":null,\"redVipAnnualCount\":-1,\"redVipLevel\":2},\"nickname\":\"唐凯nise\",\"avatarUrl\":\"http://p1.music.126.net/SUeqMM8HOIpHv9Nhl9qt9w==/109951165647004069.jpg\",\"authStatus\":0,\"expertTags\":null,\"experts\":null,\"vipType\":11,\"followed\":false},\"beReplied\":[],\"pendantData\":null,\"showFloorComment\":null,\"status\":0,\"commentId\":5601370468,\"content\":\"愿君安好\",\"contentResource\":null,\"time\":1646045699666,\"timeStr\":\"17分钟前\",\"needDisplayTime\":true,\"likedCount\":0,\"expressionUrl\":null,\"commentLocationType\":0,\"parentCommentId\":0,\"decoration\":{},\"repliedMark\":null,\"liked\":false},{\"user\":{\"locationInfo\":null,\"liveInfo\":null,\"anonym\":0,\"commonIdentity\":null,\"userId\":376189476,\"avatarDetail\":null,\"userType\":0,\"mutual\":false,\"remarkName\":null,\"vipRights\":{\"associator\":{\"vipCode\":100,\"rights\":true},\"musicPackage\":null,\"redVipAnnualCount\":-1,\"redVipLevel\":6},\"nickname\":\"梦与晨的杂货店\",\"avatarUrl\":\"http://p1.music.126.net/tCxPhRQ8ZgWD61GaZtSUJA==/109951165020050611.jpg\",\"authStatus\":0,\"expertTags\":null,\"experts\":null,\"vipType\":11,\"followed\":false},\"beReplied\":[],\"pendantData\":null,\"showFloorComment\":null,\"status\":0,\"commentId\":5601370803,\"content\":\"三月马上就要到了，城南的花要开了。\",\"contentResource\":null,\"time\":1646045645189,\"timeStr\":\"18分钟前\",\"needDisplayTime\":true,\"likedCount\":0,\"expressionUrl\":null,\"commentLocationType\":0,\"parentCommentId\":0,\"decoration\":{},\"repliedMark\":null,\"liked\":false}],\"total\":777423,\"more\":true}\n";
        JSONObject jsonObjectData1 = JSONObject.parseObject(reponse);
        JSONArray commentsArry = (JSONArray) jsonObjectData1.get("comments");
        System.out.println(jsonObjectData1);
        int f=1;
        for (int i=0;i<commentsArry.size();i++){
            System.out.println(f+"=========================================================================================================");
            JSONObject jsonObjectIndex = (JSONObject) commentsArry.get(i);
            String content = jsonObjectIndex.getString("content");
            String commentId = jsonObjectIndex.getString("commentId");
            String time = jsonObjectIndex.getString("time");
            JSONObject jsonObjectUser = (JSONObject) jsonObjectIndex.get("user");
            String userid = jsonObjectUser.getString("userId");
            String nickname = jsonObjectUser.getString("nickname");
            Comment comment = new Comment();
            comment.setCommentId(commentId);
            comment.setContent(content);
            comment.setNickname(nickname);
            String create_time = DateUtil.timeStamp2Date(time,"yyyy-MM-dd-HH");
            comment.setTime(create_time);
            comment.setUserId(userid);
            comment.setMusic_id(musinid);

            f+=1;
            commentService1.saveComment(comment);

            System.out.println(create_time);
            System.out.println(content);
            System.out.println(commentId);
            System.out.println(time);
            System.out.println(userid);
            System.out.println(nickname);
        }
    }

    public void getUserCityCode(String data,String userid){
        String city = "{\"level\":7,\"listenSongs\":1453,\"userPoint\":{\"userId\":4027493892,\"balance\":814,\"updateTime\":1646056356675,\"version\":10,\"status\":0,\"blockBalance\":0},\"mobileSign\":false,\"pcSign\":false,\"profile\":{\"privacyItemUnlimit\":{\"area\":true,\"college\":true,\"age\":true,\"villageAge\":true},\"avatarDetail\":null,\"backgroundImgIdStr\":\"109951162868126486\",\"mutual\":false,\"followed\":false,\"nickname\":\"云狐狐呐\",\"avatarUrl\":\"http://p1.music.126.net/Ggqug95v3aorkIj24ZHZOg==/109951166563040105.jpg\",\"backgroundImgId\":109951162868126486,\"backgroundUrl\":\"http://p1.music.126.net/_f8R60U9mZ42sSNvdPn2sQ==/109951162868126486.jpg\",\"birthday\":-2209017600000,\"defaultAvatar\":false,\"accountStatus\":0,\"vipType\":11,\"djStatus\":0,\"userType\":0,\"remarkName\":null,\"authStatus\":0,\"detailDescription\":\"\",\"experts\":{},\"expertTags\":null,\"createTime\":1609430419929,\"description\":\"\",\"avatarImgIdStr\":\"109951166563040105\",\"userId\":4027493892,\"avatarImgId\":109951166563040105,\"province\":510000,\"city\":511300,\"gender\":1,\"signature\":\"死于2020年的一场空梦\",\"authority\":0,\"followeds\":14,\"follows\":24,\"blacklist\":false,\"eventCount\":6,\"allSubscribedCount\":0,\"playlistBeSubscribedCount\":0,\"avatarImgId_str\":\"109951166563040105\",\"followTime\":null,\"followMe\":false,\"artistIdentity\":[],\"cCount\":0,\"inBlacklist\":false,\"sDJPCount\":0,\"playlistCount\":3,\"sCount\":0,\"newFollows\":24},\"peopleCanSeeMyPlayRecord\":true,\"bindings\":[{\"expired\":false,\"expiresIn\":2147483647,\"refreshTime\":1609430392,\"bindingTime\":1609430392187,\"tokenJsonStr\":null,\"url\":\"\",\"userId\":4027493892,\"id\":11155300300,\"type\":1},{\"expired\":true,\"expiresIn\":7776000,\"refreshTime\":1633253794,\"bindingTime\":1569897252412,\"tokenJsonStr\":null,\"url\":\"\",\"userId\":4027493892,\"id\":11155300301,\"type\":5}],\"adValid\":false,\"code\":200,\"createTime\":1609430419929,\"createDays\":424}";
        JSONObject cityJson = JSONObject.parseObject(data);
        if (cityJson.getInteger("code") == 200){
            JSONObject jsonObjectprofile = (JSONObject) cityJson.get("profile");
            String cityData = jsonObjectprofile.getString("city");
            Comment comment = new Comment();
            comment.setCity_code(cityData);
            comment.setUserId(userid);
            commentService1.updataComment(comment);
            System.out.println(JSONObject.toJSONString(comment));
        }

    }
}
